package br.com.data;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;

public class DBcore extends SQLiteOpenHelper {
	private static final String NOMEDB = "teste1";
	private static final int VERSAODB = 1;
	private static final String LOGS = "logteste";
	public DBcore (Context ctx){
		super(ctx, NOMEDB, null, VERSAODB);
	}
	
	@Override
	public void onCreate(SQLiteDatabase db) {
		Log.i(LOGS, "Entrou para criar tabela...");
		String str = "CREATE TABLE USUARIO(_id integer primary key autoincrement, "
				+ "fone text not null, nascimento text not null, sexo text not null, "
				+ "tipoSangue integer not null, ultimaDoacao text, naoReceber integer, "
				+ "repassarAmigos integer, aceitarRepassadas integer,  soMunicipal integer, "
				+ "soEstadual integer, tipoUsuario integer, senha text);";
		db.execSQL(str);
		
	}

	@Override
	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
		Log.i(LOGS, "Recriou a tabela...................");
		db.execSQL("DROP TABLE USUARIO");
		onCreate(db);
		
	}

}
